package com.amap.map2d.demo.util;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

public class SelectUtil {
    public static List<String> query(Context context, String table_name) {


        List<String> res = new ArrayList<>();
        try {
            SQLiteDbHelper helper = new SQLiteDbHelper(context);
            SQLiteDatabase database = helper.getWritableDatabase();
            Cursor cursor = database.query(table_name, null, null, null, null, null, null);
            if (cursor.moveToFirst()) {
                do {
                    String latlng = cursor.getString(cursor.getColumnIndex("latlng"));
                    res.add(latlng);
                    Log.e("--------", latlng);
                }
                while (cursor.moveToNext());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return res;
    }


}
